#! /bin/bash

# Para o Tomcat
#sh /usr/local/apache-tomcat-7.0.27/bin/shutdown.sh

# SalesAutomationService
cp bin/model/Client.class aar/SalesAutomationService/model/
cp bin/model/Product.class aar/SalesAutomationService/model/
cp bin/services/SalesAutomationService.class aar/SalesAutomationService/services/
cd aar/SalesAutomationService/
zip -r ../SalesAutomationService.aar *
cd ../../

# Storage HP Service
cp bin/model/*.class aar/StorageHPService/model/
cp bin/services/StorageHPService.class aar/StorageHPService/services/
cd aar/StorageHPService/
zip -r ../StorageHPService.aar *
cd ../../

# DatabaseService
cp bin/model/Product.class aar/DatabaseService/model/
cp bin/services/DatabaseService.class aar/DatabaseService/services/
cd aar/DatabaseService/
zip -r ../DatabaseService.aar *
cd ../../

# DatabaseService HP
cp bin/model/Product.class aar/DatabaseHPService/model/
cp bin/services/DatabaseHPService.class aar/DatabaseHPService/services/
cd aar/DatabaseHPService/
zip -r ../DatabaseHPService.aar *
cd ../../

# CreditCardService
cp bin/model/Client.class aar/CreditCardService/model/
cp bin/services/CreditCardService.class aar/CreditCardService/services/
cd aar/CreditCardService/
zip -r ../CreditCardService.aar *
cd ../../

# StorageService
cp bin/model/Client.class aar/StorageService/model/
cp bin/model/Product.class aar/StorageService/model/
cp bin/model/Payment.class aar/StorageService/model/
cp bin/services/StorageService.class aar/StorageService/services/
cd aar/StorageService/
zip -r ../StorageService.aar *
cd ../../

# MessagingService
cp bin/model/Client.class aar/MessagingService/model/
cp bin/model/Product.class aar/MessagingService/model/
cp bin/services/MessagingService.class aar/MessagingService/services/
cd aar/MessagingService/
zip -r ../MessagingService.aar *
cd ../../

# Copia todos os arquivos .aar para o diretorio de deploy do Axis2 no Tomcat
cp -R aar/*.aar /usr/local/apache-tomcat-7.0.27/webapps/axis2/WEB-INF/services/

# Inicia o Tomcat
#sh /opt/tomcat/bin/startup.sh

